package org.csu.myPetStore.domain;

import java.sql.*;

public class CloseSource {

    public void CloseSource(){}

    public void closeSource(Connection connection, PreparedStatement preparedStatement, ResultSet resultSet, Statement statement){

        if(resultSet != null){
            try {
                resultSet.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }


        if(preparedStatement != null){
            try {
                preparedStatement.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        if(statement != null){
            try {
                statement.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }


        if(connection != null) {
            try {
                connection.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }


    }


}
